/*
 * webpack.config.js
 * Copyright (C) 2017 kouen <kouen@zhoukunwudeMacBook-3.local>
 *
 * Distributed under terms of the MIT license.
 */
let webpack = require('webpack');

module.exports = {
    devtool: 'eval-source-map',        //方便调试 
    entry: __dirname + "/app/main.js", //入口文件
    output: {
        // path: "/Users/kouen/code/python/AnalySignalSystem/source/FrontEnd/Configuration/static/Configuration",   //输出目录
        // path: "/home/jobkouen/Documents/github/AnalySignalSystem/source/FrontEnd/Configuration/static/Configuration",   //输出目录
        // filename: "home.js"          //输出文件名称
        path: __dirname + "/public",
        filename: 'bundle.js'
    },

    module: {
        loaders: [
            {
                test: /\.json$/,
                loader: "json-loader"
            },
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: 'babel-loader',
                query: {
                    presets: ['es2015', 'react'],
                    "env": {
                        "development": {
                            "plugins": [["react-transform", {
                               "transforms": [{
                                 "transform": "react-transform-hmr",
                                 "imports": ["react"],
                                 "locals": ["module"]
                               }]
                            }]]
                        }
                    }
                }
            },
            {
                test: /\.css$/,
                loader: 'style-loader!css-loader?modules' //管道 !postcss-loader
            }
        ]
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin()
    ],

    devServer: {
        contentBase: "./public", //本地服务器所加载的页面所在的目录
        historyApiFallback: true, //不跳转
        inline: true, //实时刷新
        hot: true,
        host: "0.0.0.0",
        stats: { colors: true },
        proxy: {
            "/config/*": {
                target: "http://0.0.0.0:8000",
                secure: false,
                changeOrigin: true
            },
            "/account/*": {
                target: "http://0.0.0.0:8000",
                secure: false,
                changeOrigin: true
            }
        }
    }
};

